using Business.Localization;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Localization;
using Volo.Abp.MultiTenancy;

namespace Business.Permissions
{
    public class BusinessPermissionDefinitionProvider: PermissionDefinitionProvider
    {

        public override void Define(IPermissionDefinitionContext context)
        {
            var Business = context.AddGroup(BusinessPermissions.Business, L("Business"), MultiTenancySides.Tenant);

            var Book = Business.AddPermission(BusinessPermissions.Book.Default, L("Book"));
            Book.AddChild(BusinessPermissions.Book.Update, L("Edit"));
            Book.AddChild(BusinessPermissions.Book.Delete, L("Delete"));
            Book.AddChild(BusinessPermissions.Book.Create, L("Create"));

            var PrintTemplate = Business.AddPermission(BusinessPermissions.PrintTemplate.Default, L("PrintTemplate"));
            PrintTemplate.AddChild(BusinessPermissions.PrintTemplate.Update, L("Edit"));
            PrintTemplate.AddChild(BusinessPermissions.PrintTemplate.Delete, L("Delete"));
            PrintTemplate.AddChild(BusinessPermissions.PrintTemplate.Create, L("Create"));

            // More code generation...
            var Warehouse = Business.AddPermission(BusinessPermissions.Warehouse.Default, L("Warehouse"));
            Warehouse.AddChild(BusinessPermissions.Warehouse.Update, L("Edit"));
            Warehouse.AddChild(BusinessPermissions.Warehouse.Delete, L("Delete"));
            Warehouse.AddChild(BusinessPermissions.Warehouse.Create, L("Create"));

            var WarehouseArea = Business.AddPermission(BusinessPermissions.WarehouseArea.Default, L("WarehouseArea"));
            WarehouseArea.AddChild(BusinessPermissions.WarehouseArea.Update, L("Edit"));
            WarehouseArea.AddChild(BusinessPermissions.WarehouseArea.Delete, L("Delete"));
            WarehouseArea.AddChild(BusinessPermissions.WarehouseArea.Create, L("Create"));

            var Area = Business.AddPermission(BusinessPermissions.Area.Default, L("Area"));
            Area.AddChild(BusinessPermissions.Area.Update, L("Edit"));
            Area.AddChild(BusinessPermissions.Area.Delete, L("Delete"));
            Area.AddChild(BusinessPermissions.Area.Create, L("Create"));

            var WarehouseLocation = Business.AddPermission(BusinessPermissions.WarehouseLocation.Default, L("WarehouseLocation"));
            WarehouseLocation.AddChild(BusinessPermissions.WarehouseLocation.Update, L("Edit"));
            WarehouseLocation.AddChild(BusinessPermissions.WarehouseLocation.Delete, L("Delete"));
            WarehouseLocation.AddChild(BusinessPermissions.WarehouseLocation.Create, L("Create"));

            var Inventory = Business.AddPermission(BusinessPermissions.Inventory.Default, L("Inventory"));
            Inventory.AddChild(BusinessPermissions.Inventory.Update, L("Edit"));
            Inventory.AddChild(BusinessPermissions.Inventory.Delete, L("Delete"));
            Inventory.AddChild(BusinessPermissions.Inventory.Create, L("Create"));

            var Inventoryquantity = Business.AddPermission(BusinessPermissions.Inventoryquantity.Default, L("Inventoryquantity"));
            Inventoryquantity.AddChild(BusinessPermissions.Inventoryquantity.Update, L("Edit"));
            Inventoryquantity.AddChild(BusinessPermissions.Inventoryquantity.Delete, L("Delete"));
            Inventoryquantity.AddChild(BusinessPermissions.Inventoryquantity.Create, L("Create"));

            var Inventorytransit = Business.AddPermission(BusinessPermissions.Inventorytransit.Default, L("Inventorytransit"));
            Inventorytransit.AddChild(BusinessPermissions.Inventorytransit.Update, L("Edit"));
            Inventorytransit.AddChild(BusinessPermissions.Inventorytransit.Delete, L("Delete"));
            Inventorytransit.AddChild(BusinessPermissions.Inventorytransit.Create, L("Create"));

            var Inventorywarning = Business.AddPermission(BusinessPermissions.Inventorywarning.Default, L("Inventorywarning"));
            Inventorywarning.AddChild(BusinessPermissions.Inventorywarning.Update, L("Edit"));
            Inventorywarning.AddChild(BusinessPermissions.Inventorywarning.Delete, L("Delete"));
            Inventorywarning.AddChild(BusinessPermissions.Inventorywarning.Create, L("Create"));

            var Inventorystrategy = Business.AddPermission(BusinessPermissions.Inventorystrategy.Default, L("Inventorystrategy"));
            Inventorystrategy.AddChild(BusinessPermissions.Inventorystrategy.Update, L("Edit"));
            Inventorystrategy.AddChild(BusinessPermissions.Inventorystrategy.Delete, L("Delete"));
            Inventorystrategy.AddChild(BusinessPermissions.Inventorystrategy.Create, L("Create"));

            var Inventoryadjustment = Business.AddPermission(BusinessPermissions.Inventoryadjustment.Default, L("Inventoryadjustment"));
            Inventoryadjustment.AddChild(BusinessPermissions.Inventoryadjustment.Update, L("Edit"));
            Inventoryadjustment.AddChild(BusinessPermissions.Inventoryadjustment.Delete, L("Delete"));
            Inventoryadjustment.AddChild(BusinessPermissions.Inventoryadjustment.Create, L("Create"));


            var OrderLiveWareOUT = Business.AddPermission(BusinessPermissions.OrderLiveWareOUT.Default, L("OrderLiveWareOUT"));
            OrderLiveWareOUT.AddChild(BusinessPermissions.OrderLiveWareOUT.Update, L("Edit"));
            OrderLiveWareOUT.AddChild(BusinessPermissions.OrderLiveWareOUT.Delete, L("Delete"));
            OrderLiveWareOUT.AddChild(BusinessPermissions.OrderLiveWareOUT.Create, L("Create"));

            var CompanyKanBan = Business.AddPermission(BusinessPermissions.CompanyKanBan.Default, L("CompanyKanBan"));
            CompanyKanBan.AddChild(BusinessPermissions.CompanyKanBan.Update, L("Edit"));
            CompanyKanBan.AddChild(BusinessPermissions.CompanyKanBan.Delete, L("Delete"));
            CompanyKanBan.AddChild(BusinessPermissions.CompanyKanBan.Create, L("Create"));

            var WarehouseReserve = Business.AddPermission(BusinessPermissions.WarehouseReserve.Default, L("WarehouseReserve"));
            WarehouseReserve.AddChild(BusinessPermissions.WarehouseReserve.Update, L("Edit"));
            WarehouseReserve.AddChild(BusinessPermissions.WarehouseReserve.Delete, L("Delete"));
            WarehouseReserve.AddChild(BusinessPermissions.WarehouseReserve.Create, L("Create"));

            var WarehouseReserveGood = Business.AddPermission(BusinessPermissions.WarehouseReserveGood.Default, L("WarehouseReserveGood"));
            WarehouseReserveGood.AddChild(BusinessPermissions.WarehouseReserveGood.Update, L("Edit"));
            WarehouseReserveGood.AddChild(BusinessPermissions.WarehouseReserveGood.Delete, L("Delete"));
            WarehouseReserveGood.AddChild(BusinessPermissions.WarehouseReserveGood.Create, L("Create"));

            var WarehouseReserveShipper = Business.AddPermission(BusinessPermissions.WarehouseReserveShipper.Default, L("WarehouseReserveShipper"));
            WarehouseReserveShipper.AddChild(BusinessPermissions.WarehouseReserveShipper.Update, L("Edit"));
            WarehouseReserveShipper.AddChild(BusinessPermissions.WarehouseReserveShipper.Delete, L("Delete"));
            WarehouseReserveShipper.AddChild(BusinessPermissions.WarehouseReserveShipper.Create, L("Create"));

            var Return = Business.AddPermission(BusinessPermissions.Return.Default, L("Return"));
            Return.AddChild(BusinessPermissions.Return.Update, L("Edit"));
            Return.AddChild(BusinessPermissions.Return.Delete, L("Delete"));
            Return.AddChild(BusinessPermissions.Return.Create, L("Create"));

            var Brand = Business.AddPermission(BusinessPermissions.Brand.Default, L("Brand"));
            Brand.AddChild(BusinessPermissions.Brand.Update, L("Edit"));
            Brand.AddChild(BusinessPermissions.Brand.Delete, L("Delete"));
            Brand.AddChild(BusinessPermissions.Brand.Create, L("Create"));

            var SystemType = Business.AddPermission(BusinessPermissions.SystemType.Default, L("SystemType"));
            SystemType.AddChild(BusinessPermissions.SystemType.Update, L("Edit"));
            SystemType.AddChild(BusinessPermissions.SystemType.Delete, L("Delete"));
            SystemType.AddChild(BusinessPermissions.SystemType.Create, L("Create"));

            var GoodsType = Business.AddPermission(BusinessPermissions.GoodsType.Default, L("GoodsType"));
            GoodsType.AddChild(BusinessPermissions.GoodsType.Update, L("Edit"));
            GoodsType.AddChild(BusinessPermissions.GoodsType.Delete, L("Delete"));
            GoodsType.AddChild(BusinessPermissions.GoodsType.Create, L("Create"));

            var GoodsSpec = Business.AddPermission(BusinessPermissions.GoodsSpec.Default, L("GoodsSpec"));
            GoodsSpec.AddChild(BusinessPermissions.GoodsSpec.Update, L("Edit"));
            GoodsSpec.AddChild(BusinessPermissions.GoodsSpec.Delete, L("Delete"));
            GoodsSpec.AddChild(BusinessPermissions.GoodsSpec.Create, L("Create"));

            var GoodsSP = Business.AddPermission(BusinessPermissions.GoodsSP.Default, L("GoodsSP"));
            GoodsSP.AddChild(BusinessPermissions.GoodsSP.Update, L("Edit"));
            GoodsSP.AddChild(BusinessPermissions.GoodsSP.Delete, L("Delete"));
            GoodsSP.AddChild(BusinessPermissions.GoodsSP.Create, L("Create"));

            var WaitingOutBound = Business.AddPermission(BusinessPermissions.WaitingOutbound.Default, L("WaitingOutBound"));
            WaitingOutBound.AddChild(BusinessPermissions.WaitingOutbound.Update, L("Edit"));
            WaitingOutBound.AddChild(BusinessPermissions.WaitingOutbound.Delete, L("Delete"));
            WaitingOutBound.AddChild(BusinessPermissions.WaitingOutbound.Create, L("Create"));

           

            //var OrdersGoods = Business.AddPermission(BusinessPermissions.OrdersGoods.Default, L("OrdersGoods"));
            //OrdersGoods.AddChild(BusinessPermissions.OrdersGoods.Update, L("Edit"));
            //OrdersGoods.AddChild(BusinessPermissions.OrdersGoods.Delete, L("Delete"));
            //OrdersGoods.AddChild(BusinessPermissions.OrdersGoods.Create, L("Create"));

            var Orders = Business.AddPermission(BusinessPermissions.Orders.Default, L("Orders"));
            Orders.AddChild(BusinessPermissions.Orders.Update, L("Edit"));
            Orders.AddChild(BusinessPermissions.Orders.Delete, L("Delete"));
            Orders.AddChild(BusinessPermissions.Orders.Create, L("Create"));

            var Province = Business.AddPermission(BusinessPermissions.Province.Default, L("Province"));
            Province.AddChild(BusinessPermissions.Province.Update, L("Edit"));
            Province.AddChild(BusinessPermissions.Province.Delete, L("Delete"));
            Province.AddChild(BusinessPermissions.Province.Create, L("Create"));
            var Shi = Business.AddPermission(BusinessPermissions.Shi.Default, L("Shi"));
            Shi.AddChild(BusinessPermissions.Shi.Update, L("Edit"));
            Shi.AddChild(BusinessPermissions.Shi.Delete, L("Delete"));
            Shi.AddChild(BusinessPermissions.Shi.Create, L("Create"));
            var Region = Business.AddPermission(BusinessPermissions.Region.Default, L("Region"));
            Region.AddChild(BusinessPermissions.Region.Update, L("Edit"));
            Region.AddChild(BusinessPermissions.Region.Delete, L("Delete"));
            Region.AddChild(BusinessPermissions.Region.Create, L("Create"));

            var ZeroPickOrder = Business.AddPermission(BusinessPermissions.ZeroPickOrder.Default, L("ZeroPickOrder"));
            ZeroPickOrder.AddChild(BusinessPermissions.ZeroPickOrder.Update, L("Edit"));
            ZeroPickOrder.AddChild(BusinessPermissions.ZeroPickOrder.Delete, L("Delete"));
            ZeroPickOrder.AddChild(BusinessPermissions.ZeroPickOrder.Create, L("Create"));

            var Purchase = Business.AddPermission(BusinessPermissions.Purchase.Default, L("Purchase"));
            Purchase.AddChild(BusinessPermissions.Purchase.Update, L("Edit"));
            Purchase.AddChild(BusinessPermissions.Purchase.Delete, L("Delete"));
            Purchase.AddChild(BusinessPermissions.Purchase.Create, L("Create"));

            var OutWareAbnormal = Business.AddPermission(BusinessPermissions.OutWareAbnormal.Default, L("OutWareAbnormal"));
            OutWareAbnormal.AddChild(BusinessPermissions.OutWareAbnormal.Update, L("Edit"));
            OutWareAbnormal.AddChild(BusinessPermissions.OutWareAbnormal.Delete, L("Delete"));
            OutWareAbnormal.AddChild(BusinessPermissions.OutWareAbnormal.Create, L("Create"));

            var ProductionWarning = Business.AddPermission(BusinessPermissions.ProductionWarning.Default, L("ProductionWarning"));
            ProductionWarning.AddChild(BusinessPermissions.ProductionWarning.Update, L("Edit"));
            ProductionWarning.AddChild(BusinessPermissions.ProductionWarning.Delete, L("Delete"));
            ProductionWarning.AddChild(BusinessPermissions.ProductionWarning.Create, L("Create"));

            var CancelAppointment = Business.AddPermission(BusinessPermissions.CancelAppointment.Default, L("CancelAppointment"));
            CancelAppointment.AddChild(BusinessPermissions.CancelAppointment.Update, L("Edit"));
            CancelAppointment.AddChild(BusinessPermissions.CancelAppointment.Delete, L("Delete"));
            CancelAppointment.AddChild(BusinessPermissions.CancelAppointment.Create, L("Create"));

            var Plan = Business.AddPermission(BusinessPermissions.Plan.Default, L("Plan"));
            Plan.AddChild(BusinessPermissions.Plan.Update, L("Edit"));
            Plan.AddChild(BusinessPermissions.Plan.Delete, L("Delete"));
            Plan.AddChild(BusinessPermissions.Plan.Create, L("Create"));

            //Code generation...


            //var Province = Business.AddPermission(BusinessPermissions.Province.Default, L("Province"));
            //Province.AddChild(BusinessPermissions.Province.Update, L("Edit"));
            //Province.AddChild(BusinessPermissions.Province.Delete, L("Delete"));
            //Province.AddChild(BusinessPermissions.Province.Create, L("Create"));


        }

        private static LocalizableString L(string name)
        {
            return LocalizableString.Create<BusinessResource>(name);
        }
    }
}
